<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style type="text/css">
        #myDiv {
            background-color: blue;
            width: 100px;
            height: 200px;
        }
    </style>
</head>

<body>
    <h1>框架页面</h1>
    <div id="myDiv" style="background-color: red; border: 1px solid black"></div>
    <iframe id="baidu" name="baidu" src="https://www.baidu.com" style="height:650px;width:auto;">
    </iframe>
    <h3 id="b3" name="bt3">标题3</h3>
    <button onclick="postMessage()">message</button>
    <button onclick="insertNode();">动态插入一个节点</button>
    <h3 id="b4" name="bt4" class="c_bt_4" data-customName="自定义数据属性">标题4</h3>
    <ul id="myList">
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
    </ul>
    <div class="book selected">
        书本
    </div>
    <ol class="book">
        <li>java</li>
        <li class="selected">python</li>
    </ol>
    <script>
        function postMessage(){
            var fm = document.getElementById("baidu").contentWindow;
            fm.postMessage("我发了一个消息","file:///E:/Work/Electron/Electron/code/electron-browser/test_frame.html");
        }
        function insertNode() {
            var node = document.createElement("a");
            node.href = "https://17dz.com"
            node.innerText = "17dz";
            //document.body.appendChild(node);
            document.body.insertBefore(node, document.body.firstChild);
        }
    </script>
</body>

</html>